package com.ambow.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Tools {
	//日期转换
	public static String dateTransfer(String strDate ){//日期转换，将String转换成Date类型
		
		SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
		Date date,date1 = null;
		String newD=null;
		try {
			date = format.parse(strDate);
			format = new SimpleDateFormat("yyyy-MM-dd");
		 newD = format.format(date);
			//date1 =  format.parse(newD);
		
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}//有异常要捕获
		return newD;
	}
	public static void main(String[] args) {
		String s="8/8/2005";
		System.out.println(dateTransfer(s));
	}
	
}
